using Godot;
using System;

using CurrentGame.NPC;
namespace CurrentGame.Levels.DebugScene;

public partial class ShadeTeleportTest : Timer
{
	[Export]
	public float Distance { get; set; } = 100.0f;

	private ShadeCharacter _shade;
	private float _direction = 1.0f;

	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		_shade = GetNode<ShadeCharacter>("..");
        Timeout += ShadeTeleportTest_Timeout;
	}

    private void ShadeTeleportTest_Timeout()
    {
		var position = _shade.GlobalPosition;
		var target = new Vector2(position.X + _direction * Distance, position.Y);
		_shade.TeleportTo(target);
		_direction *= -1.0f;
    }
}
